package com.cskaoyan.controller.user.wx;

import com.cskaoyan.model.vo.BaseRespVo;
import com.cskaoyan.model.vo.user.wx.index.WxUserIndexData;
import com.cskaoyan.service.user.wx.WxUserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.Serializable;

/**
 * @program: project-market
 * @description: wx端user信息管理
 * @author: Jesson Guo
 * @create: 2021-12-02 22:24
 **/
@RequestMapping("wx/user")
@RestController
public class WxUserController {
    @Autowired
    WxUserService userService;

    @GetMapping("index")
    public BaseRespVo index(HttpServletRequest request) {

        Session session = SecurityUtils.getSubject().getSession();

        Integer uid = (Integer) session.getAttribute("uid");

        // unrecv、uncomment、unpaid、unship查出这四个

        WxUserIndexData data = userService.getIndex(uid);

        return BaseRespVo.ok(data);
    }
}
